<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>后台登录</title>
    <script src="__STATIC__/admin/js/jquery.min.js"></script>
    <link rel="stylesheet" href="__STATIC__/admin/css/login.css">
    <script src="__STATIC__/admin/js/layer/layer.js"></script>
    <style>
    </style>
    <script>
        function getVerify(){

            document.getElementById("verify").src="{:url('admin/index/verify')}";
        }

        $(document).ready(function () {
            $(".sub").click(function () {
                var data = {};
                data.login_name = $("#login_name").val();
                data.login_pwd =$("#login_pwd").val();
                data.code =$("#code").val();
                if(data.login_name == ""){
                    layer.msg('手滑点错了吧，没输入用户名', {icon: 2});
                    return false;
                }
                if(data.login_pwd == ""){
                    layer.msg('我去，密码没输入呀', {icon: 2});
                    return false;
                }

                if(data.code == ""){
                    layer.msg('喵,没验证码吗？', {icon: 2});
                    return false;
                }

                $.post("{:url('admin/index/toLogin')}",data,function (data) {

                    if(data == 0){
                        layer.msg('登录成功！！', {icon: 1});
                        setTimeout(function(){
                            window.location.href="{:url('admin/index/index')}"
                        },2000);
                    }else if(data == 1){
                        layer.msg('密码或账号不正确！！', {icon: 5});
                    }else if(data == 2){
                        layer.msg('验证码不正确！！', {icon: 5});
                    }
                })
            })
        })



    </script>
</head>
<body>
<div class="login-layout">
        <div class="login-form" style="position: relative">
            <div class="formContent">
                <div class="title">后台管理中心</div>
                <div class="formInfo">
                    <div class="formText">
                        <i class="icon icon-user"></i>
                        <input type="text" name='login_name' id='login_name' autocomplete="off" class="inputname input-text" value="" placeholder="用户名" />
                    </div>
                    <div class="formText">
                        <i class="icon icon-pwd"></i>
                        <input type="password" name='login_pwd' id='login_pwd' autocomplete="off" class="inputpwd input-text" value="" placeholder="密  码" />
                    </div>
                    <div class="formText">
                        <i class="icon icon-chick"></i>
                        <input type="text" name="code" autocomplete="off" class="chick_ue input-text" id="code" value="" placeholder="验证码" />
                        <img src="{:url('admin/index/verify')}" class="chicuele" id="verify" alt="" onclick="getVerify()">
                    </div>
                    <div class="formText submitDiv">
                          <span class="submit_span">
                          	<button type="submit" class="sub">登录</button>
                          </span>
                    </div>
                </div>
            </div>
            <div id="error" style="position: absolute;left:0px;bottom: 12px;text-align: center;width:441px;">
            </div>
        </div>
</div>
<div id="bannerBox">
    <ul id="slideBanner" class="slideBanner">
        <li><div style="width: 100%;height: 100%;background-image: url('__STATIC__/admin/img/banner_2.jpg');background-repeat: no-repeat;background-size:100% 100%; "></div></li>
    </ul>
</div>
</form>
</body>
</html>